import org.csource.fastdfs.*;

/**
 * @Author:ChenSheng
 * @Description:
 * @Date: Created in 下午 16:26 2018/6/13 0013
 */
public class Main {
    public static void main(String[] args) throws Exception{
        ClientGlobal.init("D:\\images\\fdfs_client.conf");
        TrackerClient trackerClient = new TrackerClient();

        TrackerServer trackerServer = trackerClient.getConnection();

        StorageServer storageServer = null;
        StorageClient storeClient = new StorageClient(trackerServer, storageServer);

        String[] urls = storeClient.upload_file("D:\\images\\a.png", "png", null);

        //
        // 显示上传结果
        for(String url: urls){
            System.out.println(url);
        }

        String result = "http://192.168.25.133/" + urls[0] + "/" + urls[1];
        System.out.println(result);

        //输出结果
        /*group1
        M00/00/00/wKgZhVsg10WAacdNAAGKYnLyuQQ968.png
        http://192.168.25.133/group1/M00/00/00/wKgZhVsg10WAacdNAAGKYnLyuQQ968.png

        Process finished with exit code 0*/

    }
}
